package com.ldl.customize.service.user;


import com.ldl.customize.dao.UserMapper;
import com.ldl.customize.entity.User;
import com.ldl.customize.entity.UserExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
* @ClassName: UserService
* @Description: 用户操作相关Service
* @author LDL
* @date 2014年4月23日 下午4:35:59
*
 */
@Service
public class UserService {

	@Autowired(required = false)
	private UserMapper userMapper;

	/**
	 *
	* @Title: getUserByName
	* @Description: 根据用户名获取用户信息
	* @param @param username
	* @param @return    设定文件
	* @return User    返回类型
	* @throws
	 */
	public User getUserByName(String username){

		UserExample example = new UserExample();
		example.createCriteria().andUserNameEqualTo(username);
		List<User> usersList = userMapper.selectByExample(example);
		return usersList.get(0);
	}
}
